<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style type="text/css">
        .father {
            width: 400px;
            height: 400px;
            margin: 0 auto;
            border: 1px solid #ddd;
            list-style-type: none;
        }

        .child {
            width: 50%;
            height: 50%;
        }

        .child-1 {
            background-color: gold;
        }

        .child-2 {
            background-color: yellowgreen;
        }
    </style>
</head>

<body>
    <div class="father">
        <li class="child child-1">child1</li>
        <li class="child child-2">child2</li>
    </div>
    <script type="text/javascript">
        // window->document->html->body-------- 事件会向上传递 直到传递到window
        var oFather = document.querySelector(".father");
        oFather.onclick = function (e) {
            var ev = e || window.event,
                target = ev.target || ev.srcElement,
                className = target.className;
            if(className.includes('child-1')){
                console.log('child-1');
            }else if(className.includes('child-2')){
                console.log('child-2');
            }else{
                console.log('father');
            }
        }
     
    </script>
</body>

</html>